<?php
/**
 * 主页
 */
namespace  app\index\controller;

use app\index\model\BannerItem as BI;
use app\index\model\Contace as Ct;
use app\index\model\Link as L;
use think\Db;



class IndexController extends BaseController{
	private $foot;
	public function _initialize(){
		$this->foot=$this->foot();
	}	
    public function index(){

        $data = Db::table('jour')
            ->where('delete_time',null)
            ->where('status',1)
            ->order('orders desc')
            ->limit(3)
            ->select();
        $this->assign([
            'data' => $data,
        ]);



    	//banners
    	$banners=BI::where('banner_id','eq',1)->where('status','eq',1)->select();
    	//信息公开link
    	$link=L::all(function($query){
    		$query->where('status','eq',1)->order('id','asc');
    	});
        //轮播图下面的简介 和 滑体
    	$cont = Db::table('banner_item')->where('id',1)->find();
        $conte = Db::table('banner_item')->where('id',2)->find();


    	$this->assign([
    		'banners'=>$banners,
    		'link'=>$link,
            'cont'=>$cont,
            'conte'=>$conte,
    		'foot'=>$this->foot
    	]);

        return $this->fetch();
    }

}
